
#include <xp/bas/stdlib.h>
#include <xp/bas/stdio.h>


int xp_main (int argc, xp_char_t* argv[])
{
	xp_byte_t i;
	xp_char_t buf[3], buf2[10];
	unsigned int n1, n2;
	int base;

	if (argc != 2) {
		xp_printf (XP_TEXT("usage: %s base\n"), argv[0]);
		return -1;
	}

	XP_STRTOI (base, argv[1], XP_NULL, 10);

	xp_printf (XP_TEXT("base = %d\n"), base);
	i = XP_TYPE_MIN(xp_byte_t);
	while (1) {
		n1 = xp_bytetostr_upper (i, buf, xp_countof(buf), base, XP_CHAR('0'));
		n2 = xp_bytetostr_lower (i, buf2, xp_countof(buf2), base, XP_CHAR('0'));
		xp_printf (XP_TEXT("%u [%s] %u [%s]\n"), n1, buf, n2, buf2);
		if (i >= XP_TYPE_MAX(xp_byte_t)) break;
		i++;	
	}

	return 0;
}
